'''----登录函数----
编写一个用户登录逻辑，用户名密码提前设置（列表嵌套字典存储），返回用户登录成功或者失败的结果。'''
user1={"username":"test1","password":"123456"}
user2={"username":"test2","password":"123456"}
user3={"username":"test3","password":"123456"}
user4={"username":"test4","password":"123456"}
user5={"username":"test5","password":"123456"}
user_list=[user1,user2,user3,user4,user5]
unm=input("请输入用户名：")
pwd=input("请输入密码：")
tag=0
for user in user_list:
    if unm ==user.get('username') and pwd== user.get("password"):
        tag=1
        break
if tag==1:
    print("登录成功")
else:
    print("登录失败")
